<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 用户输入一个数字n  3/2+4/3+5/4+...+n+1/n-->
    <script type="text/javascript">
        var n = parseInt(prompt('请输入一个正整数', 3))
        var sum = 0
        for (i = 2; i <= n; i++) {
            sum += (i + 1) / i
        }
        console.log(sum);
    </script>
</body>

</html>